<?php

$router->get('/', function () use ($router) {
    return 'Admin User API';
});

$router->get('/health', function () use ($router) {
    return 'ok';
});


$router->group(['prefix' => '/admin-api/a'], function() use ($router) {
    $router->post('/login', 'LoginController@login');
    $router->get('/users/nonce', 'UserController@getNonceQrUrl');

    $router->group([
        'middleware' => 'oauth.consumer:admin'
    ], function () use ($router) {
        $router->post('/refresh-token', 'LoginController@refreshToken');
        $router->get('/users/profile', 'ProfileController@show');
        $router->put('/users/profile', 'ProfileController@update');
        $router->put('/users/password', 'ProfileController@updatePassword');

        $router->get('/users/{userId}/nonce', 'UserController@updateNonceSecret');

        $router->get('/users', 'UserController@index');

        $router->post('/users', 'UserController@store');

        $router->get('/users/{userId}', 'UserController@show');

        $router->put('/users/{userId}', 'UserController@update');

        $router->put('/users/{userId}/password', 'UserController@updatePassword');
        $router->put('/users/{userId}/status', 'UserController@updateStatus');

        $router->get('/roles', 'RoleScopeController@getRole');
        $router->get('/scopes', 'RoleScopeController@getScope');
    });
});


